import axios from "axios";

const BASE_URL = "http://codercba.com:1888/airbnb/api";

const request = axios.create({
  baseURL: BASE_URL,
  timeout: 15000,
});

request.interceptors.request.use(
  (config) => {
    return config;
  },
  (err) => {
    console.log(err);
    return Promise.reject(err);
  }
);

request.interceptors.response.use(
  (res) => {
    return res.data;
  },
  (err) => {
    console.log(err);
    return Promise.reject(err);
  }
);

export default request;
